home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part2 / 13003 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.3 KB

  1. Path: anvil.ugrad.cs.ubc.ca!not-for-mail
  2. From: c2a192@ugrad.cs.ubc.ca (Kazimir Kylheku)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: help with strcmp
  5. Date: 3 Apr 1996 13:50:09 -0800
  6. Organization: Computer Science, University of B.C., Vancouver, B.C., Canada
  7. Message-ID: <4jurqhINNao@anvil.ugrad.cs.ubc.ca>
  8. References: <4jpiek$lp6@blaze.cs.jhu.edu> <DpAI6o.2Cq@iquest.net> <4jup7d$8s5@solutions.solon.com>
  9. NNTP-Posting-Host: anvil.ugrad.cs.ubc.ca
  10.  
  11. In article <4jup7d$8s5@solutions.solon.com>,
  12. Peter Seebach <seebs@solutions.solon.com> wrote:
  13. >Once again: feof() informs you only that the last read failed; it doesn't
  14. >belong before a read.
  15.  
  16. Whoa, are you implying that the feof() status is _undefined_ before you do the
  17. first read or merely that it's an indication of bad style to have the check
  18. before a read? I recently posted some code which does check ferror() and feof()
  19. before doing a read, although not in the same sense that Pascal newbies make
  20. the mistake. It's the code in which lines from two files are read
  21. concurrently (in the lame sense of the word, of course!), and as long as one of
  22. them has no ferror() or feof() condition, the loop has to continue.  The outer
  23. loop does a bottom test, but inside the loop, the entry into two scanning
  24. inner-loops is guarded by checking ferror() and feof(), which the first time
  25. around happens before anything is read.
  26. -- 
  27.  
  28.